package rexsee.device;

import rexsee.core.browser.Browser;
import rexsee.core.browser.clazz.JavascriptInterface;
import android.os.Build;
import android.os.Build.VERSION;

public class RexseeBuild implements JavascriptInterface {

	public static final String INTERFACE_NAME = "Build";

	@Override
	public String getInterfaceName() {
		return mBrowser.application.resources.prefix + INTERFACE_NAME;
	}
	@Override
	public JavascriptInterface getInheritInterface(Browser childBrowser) {
		return this;
	}
	@Override
	public JavascriptInterface getNewInterface(Browser childBrowser) {
		return new RexseeBuild(childBrowser);
	}

	/*
	Not Support SDK3
	public String getVersionCodeName() {
		return VERSION.CODENAME;
	}
	public String getCpuAbi() {
		return Build.CPU_ABI;
	}
	public String getManufacturer() {
		return Build.MANUFACTURER;
	}
	public String getVersionIncremental() {
		return VERSION.INCREMENTAL;
	}
	*/

	private final Browser mBrowser;
	public RexseeBuild(Browser browser) {
		mBrowser = browser;
	}

	//JavaScript Interface
	public String getRelease() {
		return VERSION.RELEASE;
	}
	public int getSdk() {
		return Integer.parseInt(VERSION.SDK);
	}

	public String getBoard() {
		return Build.BOARD;
	}
	public String getBrand() {
		return Build.BRAND;
	}
	public String getDevice() {
		return Build.DEVICE;
	}
	public String getDisplay() {
		return Build.DISPLAY;
	}
	public String getFingerPrint() {
		return Build.FINGERPRINT;
	}
	public String getHost() {
		return Build.HOST;
	}
	public String getId() {
		return Build.ID;
	}
	public String getModel() {
		return Build.MODEL;
	}
	public String getProduct() {
		return Build.PRODUCT;
	}
	public String getTags() {
		return Build.TAGS;
	}
	public String getType() {
		return Build.TYPE;
	}
	public String getUser() {
		return Build.USER;
	}
	public long getTime() {
		return Build.TIME;
	}

}
